#include <QCoreApplication>
#include"qlogmgr.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    // Set up code that uses the Qt event loop here.
    // Call a.quit() or a.exit() to quit the application.
    // A not very useful example would be including
    // #include <QTimer>
    // near the top of the file and calling
    // QTimer::singleShot(5000, &a, &QCoreApplication::quit);
    // which quits the application after 5 seconds.

    // If you do not need a running Qt event loop, remove the call
    // to a.exec() or use the Non-Qt Plain C++ Application template.

    // // 1.创建布局
    // auto* pLayout = new Log4Qt::PatternLayout();
    // pLayout->setConversionPattern("%d{yyyy-MM-dd HH:mm:ss.zzz} [%-5p] %m%n");
    // pLayout->activateOptions();

    // // 创建控制台
    // // auto* pAppender = new Log4Qt::ConsoleAppender(pLayout,Log4Qt::ConsoleAppender::STDOUT_TARGET);
    // // pAppender->activateOptions();
    // // Log4Qt::Logger::rootLogger()->addAppender(pAppender);

    // // 创建文件输出
    // QString exeDir = QCoreApplication::applicationDirPath();
    // QString strFilePath = QDir(exeDir).filePath("application.log");
    // auto* pFileAppender = new Log4Qt::FileAppender(pLayout,strFilePath,true);
    // pFileAppender->activateOptions();

    // // 3.根据记录器绑定 Appender
    // Log4Qt::Logger::rootLogger()->addAppender(pFileAppender);
    // Log4Qt::Logger::rootLogger()->setLevel(Log4Qt::Level::DEBUG_INT);

    // // 4.在日志器种输出
    // Log4Qt::Logger::rootLogger()->info("Hello");
    // Log4Qt::Logger::rootLogger()->warn("Warning");
    // Log4Qt::Logger::rootLogger()->debug("Debug");
    // Log4Qt::Logger::rootLogger()->error("Erroring");

    // // 带参数的日志
    // Log4Qt::Logger* rootLogger = Log4Qt::Logger::rootLogger();
    // int userId = 12345;
    // QString userName = "John Doe";
    // double processingTime = 2.345;
    // rootLogger->info("User processed: ID=%1, Name=%2, Time=%3ms",
    //                  userId, userName, processingTime);

    QLogMgr log;
    // // // 设置详细的日志配置
    log.setUpDetailLogging();

    //  log.setupAdvancedLogging();

    // // // 演示日志输出
    // log.demoLogging();

    // // 演示多线程日志
    log.demoMultiThreadLogging();




    return a.exec();
}
